#pragma once

#include "osCamerahandler.h"
#include "ofxVectorMath/ofxVectorMath.h"
#include "osGame.h"
#include "colorHandler.h"

class pong : public osGame
{
public:
	bool gameOn;
	ofRectangle gameOnArea;
	int padIsCircle;
	colorHandler *colors;
	int lasthit;
	//enum border
	const static int noborder = 0;
	const static int topborder = 1;
	const static int bottomborder = 2;
	const static int leftborder = 3;
	const static int rightborder = 4;
	int lastHitTime;
	int ai1;
	int ai2;
	int aispeed;
	float ballmultiplier;
	const static int padWidth = 60;
	const static int padHeight = 80;
	const static int ballRadius = 30;
	int leftPoints;
	int rightPoints;


	pong(osCamerahandler *camera,colorHandler *colors);
	~pong(void);

	osCamerahandler *camera;
	ofRectangle field;

	vector<ofPoint> pads;

	ofxVec2f ball;
	ofxVec2f ballDirection;

	void draw(int screenoffset);
	void update();
	void resetBall();
	bool collisionWithRectPad(int padNo);
	bool collisionWithCirclePad(int padNo);
	void setNewBallVector(int padNo);

	void resetGame();
	void stopGame();
	void startGame();


};
